import { Module } from '@nestjs/common';
import { MdbService } from './mdb.service';
import { MongooseModule } from '@nestjs/mongoose';
import { MongoConnectionOptions } from 'typeorm/driver/mongodb/MongoConnectionOptions';
import { UserSchema } from '../model/user.entity';

const mongoConfig = MongooseModule.forRoot('mongodb://localhost', {
  dbName: 'app_one',
  useCreateIndex: true,
  useNewUrlParser: true,
  useUnifiedTopology: true,
});

const connection: MongoConnectionOptions = {
  type: 'mongodb',
  url: 'mongodb://localhost',
  database: 'app_one',
  useNewUrlParser: true,
  useUnifiedTopology: true,
  synchronize: true,

  // entities:[UserEntity],
};

@Module({
  imports: [mongoConfig],
  providers: [MdbService],
  exports: [MdbService],
})
export class MdbModule {}
